# try:
#     num = int(input("请输入一个整数: "))
#     result = 8 / num
#     print(result)
# except ZeroDivisionError:
#     print("除数不能为0")
#
#
# try:
#     num = int(input("请输入一个整数: "))
#     result = 8 / num
#     print(result)
# except Exception as e:
#     print(f"捕获的异常类型有: {e}")


# try:
#     num = int(input("请输入数字: "))
# except ValueError:
#     print("输入的非数字")
# except Exception as e:
#     print(f"其他类型错误: {e}")
# else:
#     if num % 2 == 0:
#         print("偶数")
#     else:
#         print("奇数")
# finally:
#     print("程序运行结束")


def input_password():
    """输入函数"""
    pwd = input("请输入密码：")
    if len(pwd) < 8:
        raise Exception("输入密码长度不足8位")
    else:
        return pwd


if __name__ == '__main__':
    try:
        print(input_password())
    except Exception as e:
        print(e)